package com.xj.controller;
import com.xj.pojo.User;
import com.xj.sever.UserSever;
import com.xj.until.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "管理",tags = "后台管理")
@RestController
public class MsgController {
	@Autowired
	  UserSever sever;

	@ApiOperation("发送验证码")
	@GetMapping("/send/{phone}")
	public Result sendTenXun(@PathVariable String phone) throws Exception{
		
    	return sever.send(phone);
	}
	@ApiOperation("查询全部")
	@GetMapping("/select")
	public Result selectALl(Integer qi,Integer num){
		return sever.selectAll(qi,num);
	}

	@ApiOperation("用户注册")
	@PostMapping("/register")
	public Result register(User user){
		return sever.register(user);
	}

	@ApiOperation("删除用户")
	@PostMapping("/delete")
	public Result delete(String id){
		return sever.delete(id);
	}

	@ApiOperation("重置密码")
	@PostMapping ("/reset")
	public Result reset(Integer id){
		return sever.reset(id);
	}

	@ApiOperation("修改权限")
	@GetMapping("/authority")
	public Result authority(Integer id,String roleid){
		return sever.authority(id,roleid);
	}


}
